package stud.mpgame.physics;

/**
 * ...
 * @author pavel[f.pavel91@gmail.com]
 */
class Circle implements IBody {

	public var x:Float;
	public var y:Float;
	public var radius:Float;
	public var velocity:Vector2D;
	
	public function new(x:Float, y:Float, radius:Float, velocity:Vector2D) {
		this.x = x;
		this.y = y;
		this.radius = radius;
		this.velocity = velocity;
	}
	
	public function intersect(circle:Circle):Void {
		var dx:Float = x - circle.x;
		var dy:Float = y - circle.y;
		var distance:Float = Math.sqrt(dx * dx + dy * dy);
		if (distance  - radius - circle.radius > 0)
			return;
		//TODO
		return;
	}
	
	public function getCellX():Int {
		return Std.int(x / 64);
	}
	
	public function getCellY():Int {
		return Std.int(y / 64);
	}
	
	public function move(vector2D:Vector2D):Void {
		x += vector2D.x;
		y += vector2D.y;
	}
	
}